package org.ocelot.tunes4j.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.ocelot.tunes4j.beans.PlayList;

public interface PlayListDAO {

	@Insert("INSERT INTO PlayList (id, name) values (#{id}, #{name})")
	public void insert(PlayList playlist);
	
	@Select("SELECT * FROM PlayList WHERE name = #{name}")
	PlayList findByName(String name);

	@Delete("DELETE FROM PLAYLIST WHERE playlist_id = #{playlistId}")
	public void remove(int playlistId);
	
	@Insert("INSERT INTO PlayList_audioobject (playlist_id, audioobject_id) values (#{playlistId}, #{audioObjectId})")
	public void appendAudioObject(int playlistId, int audioObjectId);

	@Delete("DELETE FROM PLAYLIST_AUDIOOBJECT WHERE playlist_id = #{playlistId}")
	public void removeAudioObject(int playlistId);


}
